3.22.67 \(\int (3-4 x+x^2)^2 \, dx\) [2167]

Optimal. Leaf size=28 \[ -\frac {4}{3} (3-x)^3-\frac {1}{5} (3-x)^5+(-3+x)^4 \]

[Out]

-4/3*(3-x)^3-1/5*(3-x)^5+(-3+x)^4

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 28, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {624, 45} \begin {gather*} -\frac {1}{5} (3-x)^5-\frac {4}{3} (3-x)^3+(x-3)^4 \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(3 - 4*x + x^2)^2,x]

[Out]

(-4*(3 - x)^3)/3 - (3 - x)^5/5 + (-3 + x)^4

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 624

Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[1/c^p, Int[Simp[
b/2 - q/2 + c*x, x]^p*Simp[b/2 + q/2 + c*x, x]^p, x], x]] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0] && IGt
Q[p, 0] && PerfectSquareQ[b^2 - 4*a*c]

Rubi steps

\begin {align*} \int \left (3-4 x+x^2\right )^2 \, dx &=\int (-3+x)^2 (-1+x)^2 \, dx\\ &=\int \left (4 (-3+x)^2+4 (-3+x)^3+(-3+x)^4\right ) \, dx\\ &=-\frac {4}{3} (3-x)^3-\frac {1}{5} (3-x)^5+(-3+x)^4\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.00, size = 28, normalized size = 1.00 \begin {gather*} 9 x-12 x^2+\frac {22 x^3}{3}-2 x^4+\frac {x^5}{5} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(3 - 4*x + x^2)^2,x]

[Out]

9*x - 12*x^2 + (22*x^3)/3 - 2*x^4 + x^5/5

________________________________________________________________________________________

Maple [A]
time = 0.76, size = 25, normalized size = 0.89

method result size
gosper \(\frac {x \left (3 x^{4}-30 x^{3}+110 x^{2}-180 x +135\right )}{15}\) \(24\)
default \(\frac {1}{5} x^{5}-2 x^{4}+\frac {22}{3} x^{3}-12 x^{2}+9 x\) \(25\)
norman \(\frac {1}{5} x^{5}-2 x^{4}+\frac {22}{3} x^{3}-12 x^{2}+9 x\) \(25\)
risch \(\frac {1}{5} x^{5}-2 x^{4}+\frac {22}{3} x^{3}-12 x^{2}+9 x\) \(25\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^2-4*x+3)^2,x,method=_RETURNVERBOSE)

[Out]

1/5*x^5-2*x^4+22/3*x^3-12*x^2+9*x

________________________________________________________________________________________

Maxima [A]
time = 0.27, size = 24, normalized size = 0.86 \begin {gather*} \frac {1}{5} \, x^{5} - 2 \, x^{4} + \frac {22}{3} \, x^{3} - 12 \, x^{2} + 9 \, x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2-4*x+3)^2,x, algorithm="maxima")

[Out]

1/5*x^5 - 2*x^4 + 22/3*x^3 - 12*x^2 + 9*x

________________________________________________________________________________________

Fricas [A]
time = 3.01, size = 24, normalized size = 0.86 \begin {gather*} \frac {1}{5} \, x^{5} - 2 \, x^{4} + \frac {22}{3} \, x^{3} - 12 \, x^{2} + 9 \, x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2-4*x+3)^2,x, algorithm="fricas")

[Out]

1/5*x^5 - 2*x^4 + 22/3*x^3 - 12*x^2 + 9*x

________________________________________________________________________________________

Sympy [A]
time = 0.01, size = 24, normalized size = 0.86 \begin {gather*} \frac {x^{5}}{5} - 2 x^{4} + \frac {22 x^{3}}{3} - 12 x^{2} + 9 x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x**2-4*x+3)**2,x)

[Out]

x**5/5 - 2*x**4 + 22*x**3/3 - 12*x**2 + 9*x

________________________________________________________________________________________

Giac [A]
time = 0.94, size = 24, normalized size = 0.86 \begin {gather*} \frac {1}{5} \, x^{5} - 2 \, x^{4} + \frac {22}{3} \, x^{3} - 12 \, x^{2} + 9 \, x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2-4*x+3)^2,x, algorithm="giac")

[Out]

1/5*x^5 - 2*x^4 + 22/3*x^3 - 12*x^2 + 9*x

________________________________________________________________________________________

Mupad [B]
time = 0.02, size = 24, normalized size = 0.86 \begin {gather*} \frac {x^5}{5}-2\,x^4+\frac {22\,x^3}{3}-12\,x^2+9\,x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^2 - 4*x + 3)^2,x)

[Out]

9*x - 12*x^2 + (22*x^3)/3 - 2*x^4 + x^5/5

________________________________________________________________________________________